home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 August: Tool Chest / Dev.CD Aug 00 TC Disk 1.toast / pc / sample code / games / sprocketinvaders / source / eventhandler.h < prev    next >
Encoding:
Text File  |  2000-06-23  |  3.0 KB  |  121 lines

  1. /*
  2.     File:        EventHandler.h
  3.  
  4.     Contains:    xxx put contents here xxx
  5.  
  6.     Version:    xxx put version here xxx
  7.  
  8.     Copyright:    © 1998 by Apple Computer, Inc., all rights reserved.
  9.  
  10.     File Ownership:
  11.  
  12.         DRI:                xxx put dri here xxx
  13.  
  14.         Other Contact:        xxx put other contact here xxx
  15.  
  16.         Technology:            xxx put technology here xxx
  17.  
  18.     Writers:
  19.  
  20.         (cjd)    Chris DeSalvo
  21.         (sjb)    Steve Bollinger
  22.  
  23.     Change History (most recent first):
  24.  
  25.         <10>      7/1/98    cjd        Added CPU load axis to InputSprocket data set
  26.          <9>     6/18/98    sjb        InputSprocket.h comes from <> place
  27.          <8>     6/12/98    sjb        First checked in.
  28. */
  29.  
  30. //•    ------------------------------------------------------------------------------------------    •
  31. //•
  32. //•    Copyright © 1996 Apple Computer, Inc., All Rights Reserved
  33. //•
  34. //•
  35. //•        You may incorporate this sample code into your applications without
  36. //•        restriction, though the sample code has been provided "AS IS" and the
  37. //•        responsibility for its operation is 100% yours.  However, what you are
  38. //•        not permitted to do is to redistribute the source as "DSC Sample Code"
  39. //•        after having made changes. If you're going to re-distribute the source,
  40. //•        we require that you make it clear in the source that the code was
  41. //•        descended from Apple Sample Code, but that you've made changes.
  42. //•
  43. //•        Authors:
  44. //•            Chris De Salvo
  45. //•            Michael Evans
  46. //•
  47. //•    ------------------------------------------------------------------------------------------    •
  48.  
  49. #ifndef __EVENT_HANDLER__
  50. #define __EVENT_HANDLER__
  51.  
  52. //•    ------------------------------    Includes
  53.  
  54. #include <Events.h>
  55. #include <InputSprocket.h>
  56.  
  57. //•    ------------------------------    Public Definitions
  58. //•    ------------------------------    Public Types
  59.  
  60. enum
  61. {
  62.     greenMovement,
  63.     greenFire,
  64.     redMovement,
  65.     redFire,
  66.     abort,
  67.     soundToggle,
  68.     soundSprocketThrottle,
  69.     numInputs
  70. };
  71.  
  72. typedef Boolean (*EventHandlerProc)(EventRecord *theEvent);
  73.  
  74. typedef struct EventHandlerSet
  75. {
  76.     EventHandlerProc keyHandler;
  77.     EventHandlerProc autoKeyHandler;
  78.     EventHandlerProc clickHandler;
  79.     EventHandlerProc updateHandler;
  80.     EventHandlerProc diskHandler;
  81.     EventHandlerProc idleHandler;
  82. } EventHandlerSet;
  83.  
  84. typedef struct GameKeys
  85. {
  86.     Boolean    greenLeft;
  87.     Boolean    greenRight;
  88.     Boolean    greenFire;
  89.     Boolean    redLeft;
  90.     Boolean    redRight;
  91.     Boolean    redFire;
  92.     float    greenMove;
  93.     float    redMove;
  94. } GameKeys, *GameKeysPtr;
  95.  
  96. //•    ------------------------------    Public Variables
  97.  
  98. extern Boolean gDone;
  99. extern SInt32 gDeltaTime;
  100. extern EventHandlerSet gEventHandlers;
  101. extern ISpElementReference gInputElements[];
  102. extern GameKeys gGameKeys;
  103.  
  104. //•    ------------------------------    Public Functions
  105.  
  106. #ifdef __cplusplus
  107. extern "C" {
  108. #endif
  109.  
  110. extern short EventInit(void);
  111. extern void EventLoop(void);
  112. extern void RegisterEventHandlers(EventHandlerProc keyDown, EventHandlerProc autoKey, EventHandlerProc mouseDown,
  113.                             EventHandlerProc update, EventHandlerProc idle);
  114. extern void ModifyEventHandlers(EventHandlerProc keyDown, EventHandlerProc autoKey, EventHandlerProc mouseDown,
  115.                             EventHandlerProc update, EventHandlerProc idle);
  116.  
  117. #ifdef __cplusplus
  118. }
  119. #endif
  120.  
  121. #endif